<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>mamma</title>
<link rel="shortcut icon" href="../image/icon_mamma.ico">

<script src="../js/jquery-2.1.1.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script> 
<script type ="text/javascript" src ="../js/jquery.columns-1.0.min.js"></script>
<link id="style" href="../css/clean.css" rel="stylesheet" media="screen">


<script type="text/javascript">

$(document).ready(function() {
	
	mlistDiv();
	
	 $('#main').on('click',gomain); 
});


/* function output(msg){
	
		
		$('#listDiv1').html('');
		
		var get = '<table border="1" style="text-align: center;">';
		 get += '<tr>';
		 get += '<td width="100"> 이름 </td>';
		 get += '<td width="200"> 이메일 </td>'; 
		 get += '<td width="100"> 닉네임 </td>';
		 get += '<td width="100"> 거주지역 </td>';
		 get += '<td width="100"> 가입일 </td>';
		 get += '<td width="100"> 최종접속일 </td>';
		 get += '</tr>';
		  $.each(msg.mlist, function(key, item){
			 get += '<tr>';
			 get += '<td class="tdName">' + item.name + '</td>'
			 get += '<td class="tdEmail">' + item.email + '</td>'
			 get += '<td class="tdEmail">' + item.nickname + '</td>'
			 get += '<td class="tdHometown">' + item.hometown + '</td>'
			 get += '<td class="tdInputdate">' + item.inputdate + '</td>'
			 get += '<td class="tdLastAccess">' + item.lastAccess + '</td>'
			 get += '<td><input type="button" value="회원 삭제" class="btnDel" data-email="'+ item.email +'"></td>';
			 get += '</tr>';
	    }); 
		 get += '</table>';
		
		 $('#listDiv1').html(get);
		
		 $('input:button.btnDel').click(memberDel);
	}
 */
function mlistDiv(){
	
	$.ajax({
		url : 'mlist.action',
		type : 'POST',
		dataType : 'json', 	
		success:function(json) { 
			mlist = $('#mlistDiv').columns({
				data:json.mlist,
				schema: [
					{"header":"이름", "key":"name"},
					{"header":"이메일", "key":"email"},
					{"header":"닉네임", "key":"nickname"},
					{"header":"거주지역", "key":"hometown"},
					{"header":"가입일", "key":"inputdate"},
					{"header":"최종접속일", "key":"lastAccess"},
					{"header":"회원삭제", "template":'<a href="<s:url value="mdelete.action?email="/>{{email}}">삭제</a>'}
				]

			}); 
		}
	}); 
	
}


/* function memberDel() {
	
	var email = $(this).attr('data-email'); 
	
 	$.ajax({
		url: 'mdelete.action',
		type: 'POST',
		dataType: 'json',
		data: {email : email},
		success: deleteOK
	});
}

function deleteOK(msg) {
	alert('삭제되었습니다.');
	location.href='../admin/goMemberlistPage.action';
}	 */
	 
	
function gomain(){
	location.href='../admin/goAdminPage.action';
}

</script>

</head>
<body topmargin="0"  leftmargin="0" rightmargin="0">
<table id="adhead" border="0" width="100%" height="100px" style="text-align: center;background-color: #EAEAEA;">
<tr>
<td>	
	<a href="../admin/goNoticelistPage.action">공지 관리</a>
	<a href="../admin/goJusalistPage.action">백신 알림</a>
	<a href="../admin/goMemberlistPage.action">회원 목록 보기</a>
	<a href="../admin/goAdBannerPage.action">광고 관리</a>
	<a href="../account/logout.action">로그아웃</a>
</td>
</tr></table>
<h1 style="text-align: center;">[회원목록]</h1> 


<br><br>
<div id="mlistDiv" style="margin:0 auto; width: 900px;">
</div>
<form style="text-align: center;">
<input type="button" id="main" value="메인으로"></form>
</body>
</html>